﻿<!DOCTYPE html>
<!--隐患趋势折线图统计-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>
    <link href="/static/js/vue-treeselect/vue-treeselect.css" rel="stylesheet" />
    <script src="/static/js/vue-treeselect/vue-treeselect.js"></script>
    <style>
        .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }
    </style>
    <script src="/static/js/echarts2.0.js"></script>
</head>

<body>
    <div id="app" v-cloak class="popupW100">
        <el-row>
            <el-col :span="24">
                <el-form label-position="right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
                    style="margin-bottom: 15px;">
                    <el-row>
                        <el-col class="head-tool">
                            
<div class="new_title fl"><strong><img src="/static/images/icon1.png" />隐患趋势折线图统计</strong>
                            </div>

                            <span>
                                <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="4"
                                    @click="onSubmit"></btn>
                            </span>
                        </el-col>
                    </el-row>
                    <el-row>
                        
                        <!-- chy 2019-09-23 注释
                            <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.RiskEChart.RiskType+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.RiskType" slot="suffix"
                                            :placeholder="RisksManagement.RiskEChart.RiskType">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in RiskType" :label="item.value" :value="item.key">
                                            </el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.RiskEChart.RiskLevel+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.RiskLevel" slot="suffix"
                                            :placeholder="RisksManagement.RiskEChart.RiskLevel">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in RiskLevel" :label="item.value" :value="item.key">
                                            </el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                     -->

                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.RiskEChart.SelectDate+'开始'+mark.m}}
                                        </template>
                                        <el-date-picker v-model="formInline.model.DiscoveryTimeStart" type="date" slot="suffix" format="yyyy-MM-dd" value-format="yyyy-MM-dd" 
                                            size="mini" placeholder="选择日期">
                                        </el-date-picker>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.RiskEChart.SelectDate+'结束'+mark.m}}
                                        </template>
                                        <el-date-picker v-model="formInline.model.DiscoveryTimeEnd" type="date" slot="suffix" format="yyyy-MM-dd" value-format="yyyy-MM-dd" 
                                            size="mini" placeholder="选择日期">
                                        </el-date-picker>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <!-- <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.RiskEChart.Department+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.Department" slot="suffix"
                                            :placeholder="RisksManagement.RiskEChart.Department">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in Department" :label="item.label" :value="item.id">
                                            </el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col> -->

                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                                <div class="elst-select-mini">
                                    <el-form-item>
                                        <el-input size="mini">
                                            <template slot="prepend">
                                                {{RisksManagement.RiskEChart.RiskType+mark.m}}
                                            </template>
                                            <el-select @visible-change="visibleChange" v-model="formInline.model.RiskType" slot="suffix"
                                                :placeholder="RisksManagement.RiskEChart.RiskType">
                                                <el-option label="请选择" value=""></el-option>
                                                <el-option v-for="item in RiskType" :label="item.type" :value="item.id">
                                                </el-option>
                                            </el-select>
                                        </el-input>
                                    </el-form-item>
                                </div>
                            </el-col>


                        <!-- <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.RiskEChart.TimeQuantum+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.TimeQuantum" slot="suffix"
                                            :placeholder="RisksManagement.RiskEChart.TimeQuantum">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in TimeQuantum" :label="item.value"
                                                :value="item.key"></el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col> -->
                        <!-- <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.RiskEChart.FebruaryDepartment+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.FebruaryDepartment" slot="suffix"
                                            :placeholder="RisksManagement.RiskEChart.FebruaryDepartment">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in FebruaryDepartment" :label="item.value"
                                                :value="item.key"></el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col> -->
                        
                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                                <div class="elst-select-mini">
                                    <el-form-item>
                                        <el-input size="mini">
                                            <template slot="prepend">
                                                {{RisksManagement.RiskEChart.RiskLevel+mark.m}}
                                            </template>
                                            <el-select @visible-change="visibleChange" v-model="formInline.model.RiskLevel" slot="suffix"
                                                :placeholder="RisksManagement.RiskEChart.RiskLevel">
                                                <el-option label="请选择" value=""></el-option>
                                                <el-option v-for="item in RiskLevel" :label="item.level"
                                                    :value="item.id"></el-option>
                                            </el-select>
                                        </el-input>
                                    </el-form-item>
                                </div>
                            </el-col>
                        
                        
                        <!-- <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.RiskEChart.Februarylevel+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.Februarylevel" slot="suffix"
                                            :placeholder="RisksManagement.RiskEChart.Februarylevel">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in Februarylevel" :label="item.value"
                                                :value="item.key"></el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.RiskEChart.HiddenState+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.HiddenState" slot="suffix"
                                            :placeholder="RisksManagement.RiskEChart.HiddenState">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in HiddenState" :label="item.value"
                                                :value="item.key"></el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col> -->
                   
                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                                <div class="elst-select-mini">
                                    <el-form-item>
                                        <el-input size="mini">
                                            <template slot="prepend">
                                                {{RisksManagement.RiskEChart.Department+mark.m}}
                                            </template>
                                            <treeselect v-model="formInline.model.Department" :options="Department" :flat="true" slot="suffix"
                                                        style="line-height: 28px;width:70%;float: right;" placeholder="请选择" />
                                        </el-input>
                                    </el-form-item>
                                </div>
                            </el-col>
                   
                   
                    </el-row>

                </el-form>
                <div id="ChartBox" style="height:400px;margin-top:50px;"></div>
            </el-col>
        </el-row>
        <el-dialog title="Echart" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="80%"
            top="10vh">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">
        // 动态获取日期
        var tempDay = [];
        for (var i = 0; i < 15; i++) {
            var myDate = new Date(new Date().setDate(new Date().getDate() - i));    //获取当前年份(2位)
            var year = myDate.getFullYear();    //获取完整的年份(4位,1970-????)
            var month = myDate.getMonth();       //获取当前月份(0-11,0代表1月)
            if (month < 10) {
                month = "0" + (month * 1 + 1);
            };
            var day = myDate.getDate();        //获取当前日(1-31)
            if (day < 10) {
                day = "0" + day;
            };
            var dayNow = year + '-' + (month) + "-" + day;
            tempDay.push(dayNow)
        }
        var dayJson = tempDay.reverse()
        // 动态获取月
        var tempMonth = [];
        var data = new Date();
        var year = data.getFullYear();
        data.setMonth(data.getMonth() + 1, 1); //获取到当前月份,设置月份
        for (var i = 0; i < 12; i++) {
            data.setMonth(data.getMonth() - 1); //每次循环一次 月份值减1
            var m = data.getMonth() + 1;
            m = m < 10 ? "0" + m : m;
            tempMonth.push(data.getFullYear() + "-" + m);
        }
        var monthJson = tempMonth.reverse()
        // 动态获取年
        var tempYear = [];
        for (var i = 0; i < 7; i++) {
            var myDate = new Date(new Date().setDate(new Date().getDate() - i));    //获取当前年份(2位)
            var year = myDate.getFullYear() - i;    //获取完整的年份(4位,1970-????)
            var dayNow = year;
            tempYear.push(dayNow)
        }
        var yearJson = tempYear.reverse()
        app = new Vue({
            el: '#app',
            data: function () {
                return {
                    id: '0',
                    mydata: null,
                    //mytree: myTree,
                    //页面内数据初始化
                    ListItem: ListItem,
                    formInline: {
                        model: {
                            type: 'RiskCategory',
                            DateBegin: '',
                            DateEnd: '',
                            RiskType: '',
                            RiskLevel: '',
                            TimeQuantum: '',
                            Februarylevel: '',
                            FebruaryDepartment: '',
                            HiddenState: '',
                            //Department: '',
                            FebruaryDepartment: '',
                        },
                    },
                    RiskType: [],
                    RiskLevel: [],
                    TimeQuantum: [],
                    Februarylevel: [],
                    FebruaryDepartment: [],
                    HiddenState: [],
                    Department: [],
                    legend: [],
                    data: [],
                    data1: [],
                    data2: [],
                    data3: [],
                    data4: [],
                    data5: [],
                    title: '隐患趋势折线图',
                    subtext: '隐患趋势'
                }
            },
            mounted: function () {
                tablehigh(this);//计算table高度以及el-tab-pane高度
                //this.RiskLevel = getDicData('03');//字典内容
                //this.TimeQuantum = getDicData('n95');//字典内容
                //this.Februarylevel = getDicData('95');//字典内容
                //this.FebruaryDepartment = getDicData('85');//字典内容
                //this.HiddenState = getDicData('50');//字典内容
                //this.RiskType = getDicData('101');
                //this.Department = fn(this.mytree, "0");
                this.getDepartmentData();
                this.getRiskType();
                this.getRiskLevel();
                //初始化数据
                this.getData();
                //获取数据
                this.mydata = {
                    title: this.title,
                    subtext: this.subtext,
                    legend: this.legend,
                    data: this.data
                };
                //this.echartsDay()
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                //getDicValue: function (row, column, cellValue, index) {
                //    if (cellValue) {
                //        if (typeof cellValue === 'string' || typeof cellValue === 'number') {
                //            return getTreeValue(this.mydata, cellValue)
                //        }
                //        else {
                //            var result = '';
                //            for (var i = 0; i < cellValue.length; i++) {
                //                result += getTreeValue(this.mydata, cellValue[i]) + ',';
                //            }
                //            result = result.substr(0, result.length - 1);
                //            return result;
                //        }
                //    }
                //},
                //getData: function () {
                //    var mythis = this
                //    myAjax("post", mythis, '/api/RiskManageEchart/get', mythis.formInline, function (response) {
                //        mythis.legend = response.data.legend
                //        mythis.data = response.data.data
                //        mythis.title = response.data.title
                //        mythis.subtext = response.data.subtext
                //    }, false);

                //},
                ////获取分页数据
                //GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/RiskLevel/GetList') },
                //初始化部门下拉树(完成)
                getDepartmentData: function () {
                    var mythis = this;
                    myAjax("post", this, '/api/SysDepartment/GetList', { model: { Name: '', Code: '', CreateFactory: null }, offset: 0, limit: 100 }, function (response) {
                        mythis.Department = menuHelper(response.data.pageData, guidEmpty)
                        //console.log('h1', response.data.pageData);
                        //console.log('h2', mythis.department);
                    }, false);
                },
                getData: function () {
                    var mythis = this
                    //全部
                    myAjax("post", mythis, '/api/YH_StandingBookChart/GetRiskTrendLineChart?discoveryTimeStart=' + mythis.formInline.model.DiscoveryTimeStart + '&discoveryTimeEnd=' + mythis.formInline.model.DiscoveryTimeEnd + '&riskType=' + mythis.formInline.model.RiskType + '&riskLevel=' + mythis.formInline.model.RiskLevel + '&department=' + mythis.formInline.model.Department, {}, function (response) {
                        var list = response.data.result;
                        mythis.data = [];
                        dayJson = [];
                        for (var i = 0; i < list.length; i++) {
                            dayJson.push(list[i].time);
                            mythis.data.push(list[i].value);
                        }
                    }, false);
                    //一级
                    myAjax("post", mythis, '/api/YH_StandingBookChart/GetRiskTrendLineChart?level=一级&discoveryTimeStart=' + mythis.formInline.model.DiscoveryTimeStart + '&discoveryTimeEnd=' + mythis.formInline.model.DiscoveryTimeEnd + '&riskType=' + mythis.formInline.model.RiskType + '&riskLevel=' + mythis.formInline.model.RiskLevel + '&department=' + mythis.formInline.model.Department, {}, function (response) {
                        //mythis.data1 = response.data.result;
                        var list = response.data.result;
                        mythis.data1 = [];
                        for (var z = 0; z < dayJson.length; z++) {
                            var tempValue = 0;
                            for (var i = 0; i < list.length; i++) {
                                if (dayJson[z] == list[i].time) {
                                    tempValue=list[i].value;
                                }
                            }
                            mythis.data1.push(tempValue);
                        }
                    }, false);
                    //二级
                    myAjax("post", mythis, '/api/YH_StandingBookChart/GetRiskTrendLineChart?level=二级&discoveryTimeStart=' + mythis.formInline.model.DiscoveryTimeStart + '&discoveryTimeEnd=' + mythis.formInline.model.DiscoveryTimeEnd + '&riskType=' + mythis.formInline.model.RiskType + '&riskLevel=' + mythis.formInline.model.RiskLevel + '&department=' + mythis.formInline.model.Department, {}, function (response) {
                        //mythis.data2 = response.data.result;
                        var list = response.data.result;
                        mythis.data2 = [];
                        for (var z = 0; z < dayJson.length; z++) {
                            var tempValue = 0;
                            for (var i = 0; i < list.length; i++) {
                                if (dayJson[z] == list[i].time) {
                                    tempValue = list[i].value;
                                }
                            }
                            mythis.data2.push(tempValue);
                        }
                    }, false);
                    //三级
                    myAjax("post", mythis, '/api/YH_StandingBookChart/GetRiskTrendLineChart?level=三级&discoveryTimeStart=' + mythis.formInline.model.DiscoveryTimeStart + '&discoveryTimeEnd=' + mythis.formInline.model.DiscoveryTimeEnd + '&riskType=' + mythis.formInline.model.RiskType + '&riskLevel=' + mythis.formInline.model.RiskLevel + '&department=' + mythis.formInline.model.Department, {}, function (response) {
                        //mythis.data3 = response.data.result;
                        var list = response.data.result;
                        mythis.data3 = [];
                        for (var z = 0; z < dayJson.length; z++) {
                            var tempValue = 0;
                            for (var i = 0; i < list.length; i++) {
                                if (dayJson[z] == list[i].time) {
                                    tempValue = list[i].value;
                                }
                            }
                            mythis.data3.push(tempValue);
                        }
                    }, false);
                    //四级
                    myAjax("post", mythis, '/api/YH_StandingBookChart/GetRiskTrendLineChart?level=四级&discoveryTimeStart=' + mythis.formInline.model.DiscoveryTimeStart + '&discoveryTimeEnd=' + mythis.formInline.model.DiscoveryTimeEnd + '&riskType=' + mythis.formInline.model.RiskType + '&riskLevel=' + mythis.formInline.model.RiskLevel + '&department=' + mythis.formInline.model.Department, {}, function (response) {
                        //mythis.data4 = response.data.result;
                        var list = response.data.result;
                        mythis.data4 = [];
                        for (var z = 0; z < dayJson.length; z++) {
                            var tempValue = 0;
                            for (var i = 0; i < list.length; i++) {
                                if (dayJson[z] == list[i].time) {
                                    tempValue = list[i].value;
                                }
                            }
                            mythis.data4.push(tempValue);
                        }
                    }, false);
                    //重大
                    myAjax("post", mythis, '/api/YH_StandingBookChart/GetRiskTrendLineChart?level=重大&discoveryTimeStart=' + mythis.formInline.model.DiscoveryTimeStart + '&discoveryTimeEnd=' + mythis.formInline.model.DiscoveryTimeEnd + '&riskType=' + mythis.formInline.model.RiskType + '&riskLevel=' + mythis.formInline.model.RiskLevel + '&department=' + mythis.formInline.model.Department, {}, function (response) {
                        //mythis.data5 = response.data.result;
                        var list = response.data.result;
                        mythis.data5 = [];
                        for (var z = 0; z < dayJson.length; z++) {
                            var tempValue = 0;
                            for (var i = 0; i < list.length; i++) {
                                if (dayJson[z] == list[i].time) {
                                    tempValue = list[i].value;
                                }
                            }
                            mythis.data5.push(tempValue);
                        }


                    }, false);

                    var myChart = echarts.init(document.getElementById('ChartBox'));
                    option = {
                        title: {
                            text: '隐患趋势折线图日统计'
                        },
                        tooltip: {
                            trigger: 'axis',
                            axisPointer: {
                                type: 'cross',
                                label: {
                                    backgroundColor: '#6a7985'
                                }
                            }
                        },
                        legend: {
                            data: ['全部', '一级', '二级', '三级', '四级', '重大']
                        },
                        toolbox: {
                            feature: {
                                saveAsImage: {}
                            }
                        },
                        grid: {
                            left: '3%',
                            right: '4%',
                            bottom: '3%',
                            containLabel: true
                        },
                        xAxis: [
                            {
                                type: 'category',
                                boundaryGap: false,
                                data: dayJson
                            }
                        ],
                        yAxis: [
                            {
                                type: 'value'
                            }
                        ],
                        series: [
                            {
                                name: '全部',
                                type: 'line',
                                stack: '总量',
                                areaStyle: {},
                                data: mythis.data
                            },
                            {
                                name: '一级',
                                type: 'line',
                                stack: '总量',
                                areaStyle: {},
                                data: mythis.data1
                            },
                            {
                                name: '二级',
                                type: 'line',
                                stack: '总量',
                                areaStyle: {},
                                data: mythis.data2
                            },
                            {
                                name: '三级',
                                type: 'line',
                                stack: '总量',
                                areaStyle: { normal: {} },
                                data: mythis.data3
                            },
                            {
                                name: '四级',
                                type: 'line',
                                stack: '总量',
                                areaStyle: { normal: {} },
                                data: mythis.data4
                            },
                            {
                                name: '重大',
                                type: 'line',
                                stack: '总量',
                                label: {
                                    normal: {
                                        show: true,
                                        position: 'top'
                                    }
                                },
                                areaStyle: { normal: {} },
                                data: mythis.data5
                            }
                        ]
                    };
                    myChart.setOption(option);
                       

                },
                //初始化级别
                getRiskLevel: function () {
                    var mythis = this;
                    myAjax("post", this, '/api/YH_Grade/GetList', { model: {}, offset: 0, limit: 100 }, function (response) {
                        mythis.RiskLevel = response.data.pageData;

                        //console.log(response.data.pageData);
                    }, false);
                },
                //初始化类别
                getRiskType: function () {
                    var mythis = this;
                    myAjax("post", this, '/api/YH_Type/GetList', { model: {}, offset: 0, limit: 100 }, function (response) {
                        mythis.RiskType = response.data.pageData;

                        //console.log(response.data.pageData);
                    }, false);
                },
                //获取分页数据
                GetPageData: function (currentIndex) {
                    this.getData();//GetPageData(this, currentIndex, '/api/RiskLevel/GetList')
                },
                //查询方法
                onSubmit: function () {
                    //onSubmit(this);
                    this.getData();
                },
                ////查询方法
                //onSubmit: function () {
                //    if (this.formInline.model.TimeQuantum == 0) {
                //        this.echartsDay()
                //    } else if (this.formInline.model.TimeQuantum == 1) {
                //        this.echartsWeek()
                //    } else if (this.formInline.model.TimeQuantum == 2) {
                //        this.echartsMonth()
                //    } else if (this.formInline.model.TimeQuantum == 3) {
                //        this.echartsYear()
                //    }
                //    onSubmit(this);

                //},
                //// 日图表
                //echartsDay: function () {
                //    var myChart = echarts.init(document.getElementById('ChartBox'));
                //    option = {
                //        title: {
                //            text: '隐患趋势折线日统计'
                //        },
                //        tooltip: {
                //            trigger: 'axis',
                //            axisPointer: {
                //                type: 'cross',
                //                label: {
                //                    backgroundColor: '#6a7985'
                //                }
                //            }
                //        },
                //        legend: {
                //            data: ['趋势A', '趋势B', '趋势C', '趋势D', '趋势E', '趋势F']
                //        },
                //        toolbox: {
                //            feature: {
                //                saveAsImage: {}
                //            }
                //        },
                //        grid: {
                //            left: '3%',
                //            right: '4%',
                //            bottom: '3%',
                //            containLabel: true
                //        },
                //        xAxis: [
                //            {
                //                type: 'category',
                //                boundaryGap: false,
                //                data: dayJson
                //            }
                //        ],
                //        yAxis: [
                //            {
                //                type: 'value'
                //            }
                //        ],
                //        series: [
                //            {
                //                name: '趋势A',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: {},
                //                data: [12, 13, 11, 14, 9, 23, 20, 31, 12, 13, 10, 13, 9, 23, 21, 31]
                //            },
                //            {
                //                name: '趋势B',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: {},
                //                data: [22, 18, 19, 23, 29, 33, 31, 41, 22, 18, 19, 23, 29, 33, 31, 41]
                //            },
                //            {
                //                name: '趋势C',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: {},
                //                data: [10, 23, 20, 14, 19, 33, 41, 51, 15, 23, 20, 15, 19, 30, 40, 51]
                //            },
                //            {
                //                name: '趋势D',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: { normal: {} },
                //                data: [32, 33, 30, 33, 39, 33, 32, 33, 32, 33, 30, 33, 39, 33, 32, 33]
                //            },
                //            {
                //                name: '趋势E',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: { normal: {} },
                //                data: [32, 33, 30, 33, 39, 33, 32, 33, 32, 33, 30, 33, 39, 33, 32, 33]
                //            },
                //            {
                //                name: '趋势F',
                //                type: 'line',
                //                stack: '总量',
                //                label: {
                //                    normal: {
                //                        show: true,
                //                        position: 'top'
                //                    }
                //                },
                //                areaStyle: { normal: {} },
                //                data: [82, 93, 90, 93, 129, 133, 132, 156, 82, 93, 90, 93, 129, 133, 132, 156]
                //            }
                //        ]
                //    };
                //    myChart.setOption(option);
                //},
                //// 周图表
                //echartsWeek: function () {
                //    var myChart = echarts.init(document.getElementById('ChartBox'));
                //    option = {
                //        title: {
                //            text: '隐患趋势折线图周统计'
                //        },
                //        tooltip: {
                //            trigger: 'axis',
                //            axisPointer: {
                //                type: 'cross',
                //                label: {
                //                    backgroundColor: '#6a7985'
                //                }
                //            }
                //        },
                //        legend: {
                //            data: ['趋势A', '趋势B', '趋势C', '趋势D', '趋势E', '趋势F']
                //        },
                //        toolbox: {
                //            feature: {
                //                saveAsImage: {}
                //            }
                //        },
                //        grid: {
                //            left: '3%',
                //            right: '4%',
                //            bottom: '3%',
                //            containLabel: true
                //        },
                //        xAxis: [
                //            {
                //                type: 'category',
                //                boundaryGap: false,
                //                data: ['第1周', '第2周', '第3周', '第4周', '第5周', '第6周', '第7周']
                //            }
                //        ],
                //        yAxis: [
                //            {
                //                type: 'value'
                //            }
                //        ],
                //        series: [
                //            {
                //                name: '趋势A',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: {},
                //                data: [120, 132, 101, 134, 90, 230, 210, 310]
                //            },
                //            {
                //                name: '趋势B',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: {},
                //                data: [220, 182, 191, 234, 290, 330, 310, 410]
                //            },
                //            {
                //                name: '趋势C',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: {},
                //                data: [150, 232, 201, 154, 190, 330, 410, 510]
                //            },
                //            {
                //                name: '趋势D',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: { normal: {} },
                //                data: [320, 332, 301, 334, 390, 330, 320, 330]
                //            },
                //            {
                //                name: '趋势E',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: { normal: {} },
                //                data: [320, 332, 301, 334, 390, 330, 320, 330]
                //            },
                //            {
                //                name: '趋势F',
                //                type: 'line',
                //                stack: '总量',
                //                label: {
                //                    normal: {
                //                        show: true,
                //                        position: 'top'
                //                    }
                //                },
                //                areaStyle: { normal: {} },
                //                data: [820, 932, 901, 934, 1290, 1330, 1320, 1560]
                //            }
                //        ]
                //    };
                //    myChart.setOption(option);
                //},
                //// 月图表
                //echartsMonth: function () {
                //    var myChart = echarts.init(document.getElementById('ChartBox'));
                //    option = {
                //        title: {
                //            text: '隐患趋势折线图月统计'
                //        },
                //        tooltip: {
                //            trigger: 'axis',
                //            axisPointer: {
                //                type: 'cross',
                //                label: {
                //                    backgroundColor: '#6a7985'
                //                }
                //            }
                //        },
                //        legend: {
                //            data: ['趋势A', '趋势B', '趋势C', '趋势D', '趋势E', '趋势F']
                //        },
                //        toolbox: {
                //            feature: {
                //                saveAsImage: {}
                //            }
                //        },
                //        grid: {
                //            left: '3%',
                //            right: '4%',
                //            bottom: '3%',
                //            containLabel: true
                //        },
                //        xAxis: [
                //            {
                //                type: 'category',
                //                boundaryGap: false,
                //                data: monthJson
                //            }
                //        ],
                //        yAxis: [
                //            {
                //                type: 'value'
                //            }
                //        ],
                //        series: [
                //            {
                //                name: '趋势A',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: {},
                //                data: [12 * 30, 13 * 30, 11 * 30, 14 * 30, 9 * 30, 23 * 30, 20 * 30, 31 * 30, 12 * 30, 13 * 30, 10 * 30, 13 * 30]
                //            },
                //            {
                //                name: '趋势B',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: {},
                //                data: [22 * 30, 18 * 30, 19 * 30, 23 * 30, 29 * 30, 33 * 30, 31 * 30, 41 * 30, 22 * 30, 18 * 30, 19 * 30, 23 * 30]
                //            },
                //            {
                //                name: '趋势C',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: {},
                //                data: [10 * 30, 23 * 30, 20 * 30, 14 * 30, 19 * 30, 33 * 30, 41 * 30, 51 * 30, 15 * 30, 23 * 30, 20 * 30, 15 * 30]
                //            },
                //            {
                //                name: '趋势D',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: { normal: {} },
                //                data: [32 * 30, 33 * 30, 30 * 30, 33 * 30, 39 * 30, 33 * 30, 32 * 30, 33 * 30, 32 * 30, 33 * 30, 30 * 30, 33 * 30]
                //            },
                //            {
                //                name: '趋势E',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: { normal: {} },
                //                data: [32 * 30, 33 * 30, 30 * 30, 33 * 30, 39 * 30, 33 * 30, 32 * 30, 33 * 30, 32 * 30, 33 * 30, 30 * 30, 33 * 30]
                //            },
                //            {
                //                name: '趋势F',
                //                type: 'line',
                //                stack: '总量',
                //                label: {
                //                    normal: {
                //                        show: true,
                //                        position: 'top'
                //                    }
                //                },
                //                areaStyle: { normal: {} },
                //                data: [82 * 30, 93 * 30, 90 * 30, 93 * 30, 129 * 30, 133 * 30, 132 * 30, 156 * 30, 82 * 30, 93 * 30, 90 * 30, 93 * 30]
                //            }
                //        ]
                //    };
                //    myChart.setOption(option);
                //},
                //// 年图表
                //echartsYear: function () {
                //    var myChart = echarts.init(document.getElementById('ChartBox'));
                //    option = {
                //        title: {
                //            text: '隐患趋势折线图年统计'
                //        },
                //        tooltip: {
                //            trigger: 'axis',
                //            axisPointer: {
                //                type: 'cross',
                //                label: {
                //                    backgroundColor: '#6a7985'
                //                }
                //            }
                //        },
                //        legend: {
                //            data: ['趋势A', '趋势B', '趋势C', '趋势D', '趋势E', '趋势F']
                //        },
                //        toolbox: {
                //            feature: {
                //                saveAsImage: {}
                //            }
                //        },
                //        grid: {
                //            left: '3%',
                //            right: '4%',
                //            bottom: '3%',
                //            containLabel: true
                //        },
                //        xAxis: [
                //            {
                //                type: 'category',
                //                boundaryGap: false,
                //                data: yearJson
                //            }
                //        ],
                //        yAxis: [
                //            {
                //                type: 'value'
                //            }
                //        ],
                //        series: [
                //            {
                //                name: '趋势A',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: {},
                //                data: [12 * 365, 13 * 365, 11 * 365, 14 * 365, 9 * 365, 23 * 365, 20 * 365]
                //            },
                //            {
                //                name: '趋势B',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: {},
                //                data: [22 * 365, 18 * 365, 19 * 365, 23 * 365, 29 * 365, 33 * 365, 31 * 365]
                //            },
                //            {
                //                name: '趋势C',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: {},
                //                data: [10 * 365, 23 * 365, 20 * 365, 14 * 365, 19 * 365, 33 * 365, 41 * 365]
                //            },
                //            {
                //                name: '趋势E',
                //                type: 'line',
                //                stack: '总量',
                //                areaStyle: { normal: {} },
                //                data: [32 * 365, 33 * 365, 30 * 365, 33 * 365, 39 * 365, 33 * 365, 32 * 365]
                //            },
                //            {
                //                name: '趋势F',
                //                type: 'line',
                //                stack: '总量',
                //                label: {
                //                    normal: {
                //                        show: true,
                //                        position: 'top'
                //                    }
                //                },
                //                areaStyle: { normal: {} },
                //                data: [82 * 365, 93 * 365, 90 * 365, 93 * 365, 129 * 365, 133 * 365, 132 * 365]
                //            }
                //        ]
                //    };
                //    myChart.setOption(option);
                //},
            }
        });

        //下拉树数据格式化
        function menuHelper(list, pid) {
            var result = [];
            if (list.length <= 0)
                return list;
            list.forEach(function (v, i) {
                var temp = {};
                for (var key in v) {
                    temp[key] = v[key];
                }
                temp.label = v.name;
                temp.parentId = temp.parentId ? temp.parentId : guidEmpty;
                var obj;
                if (temp.parentId == pid) {
                    obj = temp;
                    var nextObj = menuHelper(list, temp.id);
                    if (nextObj.length > 0) {
                        obj.children = nextObj;
                    }
                }
                if (obj)
                    result.push(obj)
            })
            return result;

        }

    </script>
</body>

</html>